home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / Forms Misc / max-entry.izs < prev    next >
Text File  |  2005-09-28  |  2KB  |  92 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>Max Entry
  4. <!/TITLE>
  5.  
  6. <!DESCRIPTION>Make sure your visitor doesn't exceed the maximum number of characters that you want to accept in a form.<!/DESCRIPTION> 
  7.  
  8. <!CATEGORY>Forms<!/CATEGORY>
  9.  
  10. <!SCRIPT>
  11. <!-- START OF SCRIPT -->
  12.  
  13.  
  14. <!-- HOW TO INSTALL MAX ENTRY:
  15.  
  16.   1.  Copy code into the HEAD section of document
  17.   2.  Put last coding into the BODY section of document  -->
  18.  
  19. <!-- STEP ONE: Add code into HEAD section of document  -->
  20.  
  21. <SCRIPT LANGUAGE="JavaScript">
  22.  
  23.  
  24.  
  25. <!-- Begin
  26. function checkchars(form) {
  27. var max=15;
  28. if (form.chars.value.length > max) {
  29. alert("Please do not enter more than 15 characters.  Please shorten your entry and submit again.");
  30. return false;
  31.    }
  32. else return true;
  33. }
  34. // End -->
  35. </script>
  36.  
  37. <!-- STEP TWO: Add code into BODY section of document  -->
  38.  
  39. <center>
  40. <form onsubmit="return checkchars(this)">
  41. Please type 15 characters or less.<br>
  42. <textarea rows=5 cols=30 name=chars wrap=virtual></textarea>
  43. <br><input type=submit value="Submit!">
  44. </form>
  45. </center>
  46.  
  47.  
  48.  
  49. <!-- END OF SCRIPT -->
  50. <!/SCRIPT>
  51.  
  52. <!PREVIEW>
  53. <!-- START OF SCRIPT -->
  54.  
  55. <!-- HOW TO INSTALL MAX ENTRY:
  56.  
  57.   1.  Copy code into the HEAD section of document
  58.   2.  Put last coding into the BODY section of document  -->
  59.  
  60. <!-- STEP ONE: Add code into HEAD section of document  -->
  61.  
  62. <SCRIPT LANGUAGE="JavaScript">
  63.  
  64.  
  65.  
  66. <!-- Begin
  67. function checkchars(form) {
  68. var max=15;
  69. if (form.chars.value.length > max) {
  70. alert("Please do not enter more than 15 characters.  Please shorten your entry and submit again.");
  71. return false;
  72.    }
  73. else return true;
  74. }
  75. // End -->
  76. </script>
  77.  
  78. <!-- STEP TWO: Add code into BODY section of document  -->
  79.  
  80. <center>
  81. <form onsubmit="return checkchars(this)">
  82. Please type 15 characters or less.<br>
  83. <textarea rows=5 cols=30 name=chars wrap=virtual></textarea>
  84. <br><input type=submit value="Submit!">
  85. </form>
  86. </center>
  87.  
  88. <!-- END OF SCRIPT -->
  89. <!/PREVIEW>
  90.  
  91. <!RELATED>NONE<!/RELATED>
  92.